package net.jxiny.oschina.tweet.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import com.flyco.tablayout.SlidingTabLayout;

import net.jxiny.oschina.R;
import net.jxiny.oschina.synthetical.fragment.AnswerFragemnt;
import net.jxiny.oschina.synthetical.fragment.BlogFragment;
import net.jxiny.oschina.synthetical.fragment.EnglishFragment;
import net.jxiny.oschina.synthetical.fragment.InformationFragment;
import net.jxiny.oschina.synthetical.fragment.RecommendFragment;
import net.jxiny.oschina.synthetical.fragment.SoftwareFragemnt;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

public class TweetFragment extends Fragment {
    @BindView(R.id.tl_tweet)
    SlidingTabLayout tab;
    @BindView(R.id.vp_tweet)
    ViewPager pager;
    private ArrayList<Fragment> mFragments=new ArrayList<>();
    private final String[] mTitles={
            "最新","热门","话题","乱弹","我的"
    };
    private Unbinder binder;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

        View view=inflater.inflate(R.layout.fragment_tweet,container,false);
        binder= ButterKnife.bind(this,view);
        return view;


    }
    @Override
    public void onViewCreated(@NonNull View view,@NonNull Bundle savedInstasceState){
        super.onViewCreated(view,savedInstasceState);
        mFragments.add(new TopicFragment());
        mFragments.add(new NewestFragment());
        mFragments.add(new MusicFragment());
        mFragments.add(new HotFragment());
        mFragments.add(new MineFragment());
        tab.setViewPager(pager,mTitles,getActivity(),mFragments);
    }
    @Override
    public void onDestroyView() {
        super.onDestroyView();
        binder.unbind();
    }
}
